package Demo04.demo06;
 
import java.io.File;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class Server {
 
	public static void main(String[] args) throws IOException {
		
		File dir = new File("G:\\刘文野\\新建文件夹");
		//创建一个服务
		ServerSocket ss = new ServerSocket(7777);
		System.out.println("Softeem文件服务器已启动...");
		while(true){
			//监听一个客户端连接
			Socket s = ss.accept();
			System.out.println("客户端连接："+s.getInetAddress());
			//针对当前产生的Socket开启文件服务
			FileService fs = new FileService(s);
			//设置目标目录
			fs.setDir(dir);
			//启动服务
			fs.start();
		}
	}
}